import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component: () => import('@/components/login')
  },
  {
    path: '/chat',
    name: 'Chat',
    // redirect: '/chat/user/',
    component: () => import('@/components/chat-room')
  },
  {
    path: '/room',
    name: 'Room',
    component: () => import('@/components/room')
  }
]

const router = new VueRouter({
  routes
})

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch((err) => err)
}

export default router
